package com.whoiszxl.feign;

import com.whoiszxl.command.MemberAddressApplicationService;
import com.whoiszxl.core.entity.ResponseResult;
import com.whoiszxl.core.utils.AuthUtils;
import com.whoiszxl.dto.MemberAddressFeignDTO;
import com.whoiszxl.query.MemberAddressQueryApplicationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 会员feign接口实现
 *
 * @author whoiszxl
 * @date 2022/4/11
 */
@RestController
@RequiredArgsConstructor
public class MemberFeignClientImpl implements MemberFeignClient {

    private final MemberAddressApplicationService memberAddressApplicationService;

    private final MemberAddressQueryApplicationService memberAddressQueryApplicationService;


    @Override
    public ResponseResult<MemberAddressFeignDTO> getMemberAddress(Long addressId) {
        Long memberId = AuthUtils.getMemberId();
        MemberAddressFeignDTO memberAddressFeignDTO = memberAddressQueryApplicationService.getMemberAddress(memberId, addressId);
        return ResponseResult.buildSuccess(memberAddressFeignDTO);
    }
}
